#include "ElementFactoryFactory.h"


ElementFactoryFactory * ElementFactoryFactory::instance = 0;

ElementFactoryFactory::ElementFactoryFactory(void)
{
	factoryMap["sapo"] = new FrogFactory();
	factoryMap["textura"] = new TextureFactory();
	factoryMap["carril"] = new RailFactory();
	factoryMap["sumidero"] = new DrainageFactory();
	factoryMap["triangulo"] = new TriangleObstacleFactory();
	factoryMap["cuadrado"] = new SquareObstacleFactory();
	factoryMap["circulo"] = new CircleObstacleFactory();
	factoryMap["fuente"] = new SourceFactory();
}

ElementFactoryFactory::~ElementFactoryFactory(void)
{
	delete factoryMap["sapo"];
	delete factoryMap["textura"];
	delete factoryMap["carril"];
	delete factoryMap["sumidero"];
	delete factoryMap["triangulo"];
	delete factoryMap["cuadrado"];
	delete factoryMap["circulo"];
	delete factoryMap["fuente"];
}

ElementFactoryFactory* ElementFactoryFactory::getInstance()
{
	if(!instance){
		instance = new ElementFactoryFactory();
	}
	return instance;
}

ElementFactory* ElementFactoryFactory::getFactory( string type )
{
	return factoryMap[type];
}